home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 1.toast / Sample Code / Graphics 2D / BrightContrastEngine / BCEngine.i.c < prev    next >
Encoding:
Text File  |  2000-09-28  |  8.9 KB  |  317 lines  |  [TEXT/CWIE]

  1. //****************************************************************************************
  2. // BCEngine.i.c
  3. //
  4. // Copyright 1999 by Apple Computer, Inc.
  5. //----------------------------------------------------------------------------------------
  6.  
  7. #include <AVComponents.h>
  8. #include <MixedMode.h>
  9.  
  10. #include "BCEngine.h"
  11.  
  12.  
  13.  
  14. pascal ContrastEngineResult ContrastEngineGetBrightnessRange(ComponentInstance ec, short* min, short* max)
  15. {
  16.     #if PRAGMA_STRUCT_ALIGN
  17.       #pragma options align=mac68k
  18.     #elif PRAGMA_STRUCT_PACKPUSH
  19.       #pragma pack(push, 2)
  20.     #elif PRAGMA_STRUCT_PACK
  21.       #pragma pack(2)
  22.     #endif
  23.     struct ContrastEngineGetBrightnessRangeGluePB {
  24.         unsigned char                  componentFlags;
  25.         unsigned char                  componentParamSize;
  26.         short                          componentWhat;
  27.         short*                         max;
  28.         short*                         min;
  29.         ComponentInstance              ec;
  30.     };
  31.     #if PRAGMA_STRUCT_ALIGN
  32.       #pragma options align=reset
  33.     #elif PRAGMA_STRUCT_PACKPUSH
  34.       #pragma pack(pop)
  35.     #elif PRAGMA_STRUCT_PACK
  36.       #pragma pack()
  37.     #endif
  38.  
  39.     #if OLD_COMPONENT_GLUE
  40.     struct ContrastEngineGetBrightnessRangeGluePB myContrastEngineGetBrightnessRangeGluePB = {
  41.         0,
  42.         8,
  43.         0
  44.     };
  45.  
  46.     #else
  47.     struct ContrastEngineGetBrightnessRangeGluePB myContrastEngineGetBrightnessRangeGluePB;
  48.     *((unsigned long*)&myContrastEngineGetBrightnessRangeGluePB) = 0x00080000;
  49.     #endif
  50.  
  51.     myContrastEngineGetBrightnessRangeGluePB.max = max;
  52.     myContrastEngineGetBrightnessRangeGluePB.min = min;
  53.     myContrastEngineGetBrightnessRangeGluePB.ec = ec;
  54.  
  55.     return (ContrastEngineResult)CallUniversalProc(CallComponentUPP, 0x000000F0, &myContrastEngineGetBrightnessRangeGluePB);
  56. }
  57.  
  58.  
  59. pascal ContrastEngineResult ContrastEngineGetBrightness(ComponentInstance ec, short* brightness)
  60. {
  61.     #if PRAGMA_STRUCT_ALIGN
  62.       #pragma options align=mac68k
  63.     #elif PRAGMA_STRUCT_PACKPUSH
  64.       #pragma pack(push, 2)
  65.     #elif PRAGMA_STRUCT_PACK
  66.       #pragma pack(2)
  67.     #endif
  68.     struct ContrastEngineGetBrightnessGluePB {
  69.         unsigned char                  componentFlags;
  70.         unsigned char                  componentParamSize;
  71.         short                          componentWhat;
  72.         short*                         brightness;
  73.         ComponentInstance              ec;
  74.     };
  75.     #if PRAGMA_STRUCT_ALIGN
  76.       #pragma options align=reset
  77.     #elif PRAGMA_STRUCT_PACKPUSH
  78.       #pragma pack(pop)
  79.     #elif PRAGMA_STRUCT_PACK
  80.       #pragma pack()
  81.     #endif
  82.  
  83.     #if OLD_COMPONENT_GLUE
  84.     struct ContrastEngineGetBrightnessGluePB myContrastEngineGetBrightnessGluePB = {
  85.         0,
  86.         4,
  87.         1
  88.     };
  89.  
  90.     #else
  91.     struct ContrastEngineGetBrightnessGluePB myContrastEngineGetBrightnessGluePB;
  92.     *((unsigned long*)&myContrastEngineGetBrightnessGluePB) = 0x00040001;
  93.     #endif
  94.  
  95.     myContrastEngineGetBrightnessGluePB.brightness = brightness;
  96.     myContrastEngineGetBrightnessGluePB.ec = ec;
  97.  
  98.     return (ContrastEngineResult)CallUniversalProc(CallComponentUPP, 0x000000F0, &myContrastEngineGetBrightnessGluePB);
  99. }
  100.  
  101.  
  102. pascal ContrastEngineResult ContrastEngineSetBrightness(ComponentInstance ec, short brightness)
  103. {
  104.     #if PRAGMA_STRUCT_ALIGN
  105.       #pragma options align=mac68k
  106.     #elif PRAGMA_STRUCT_PACKPUSH
  107.       #pragma pack(push, 2)
  108.     #elif PRAGMA_STRUCT_PACK
  109.       #pragma pack(2)
  110.     #endif
  111.     struct ContrastEngineSetBrightnessGluePB {
  112.         unsigned char                  componentFlags;
  113.         unsigned char                  componentParamSize;
  114.         short                          componentWhat;
  115.         short                          brightness;
  116.         ComponentInstance              ec;
  117.     };
  118.     #if PRAGMA_STRUCT_ALIGN
  119.       #pragma options align=reset
  120.     #elif PRAGMA_STRUCT_PACKPUSH
  121.       #pragma pack(pop)
  122.     #elif PRAGMA_STRUCT_PACK
  123.       #pragma pack()
  124.     #endif
  125.  
  126.     #if OLD_COMPONENT_GLUE
  127.     struct ContrastEngineSetBrightnessGluePB myContrastEngineSetBrightnessGluePB = {
  128.         0,
  129.         2,
  130.         2
  131.     };
  132.  
  133.     #else
  134.     struct ContrastEngineSetBrightnessGluePB myContrastEngineSetBrightnessGluePB;
  135.     *((unsigned long*)&myContrastEngineSetBrightnessGluePB) = 0x00020002;
  136.     #endif
  137.  
  138.     myContrastEngineSetBrightnessGluePB.brightness = brightness;
  139.     myContrastEngineSetBrightnessGluePB.ec = ec;
  140.  
  141.     return (ContrastEngineResult)CallUniversalProc(CallComponentUPP, 0x000000F0, &myContrastEngineSetBrightnessGluePB);
  142. }
  143.  
  144.  
  145. pascal ContrastEngineResult ContrastEngineGetContrastRange(ComponentInstance ec, short* min, short* max)
  146. {
  147.     #if PRAGMA_STRUCT_ALIGN
  148.       #pragma options align=mac68k
  149.     #elif PRAGMA_STRUCT_PACKPUSH
  150.       #pragma pack(push, 2)
  151.     #elif PRAGMA_STRUCT_PACK
  152.       #pragma pack(2)
  153.     #endif
  154.     struct ContrastEngineGetContrastRangeGluePB {
  155.         unsigned char                  componentFlags;
  156.         unsigned char                  componentParamSize;
  157.         short                          componentWhat;
  158.         short*                         max;
  159.         short*                         min;
  160.         ComponentInstance              ec;
  161.     };
  162.     #if PRAGMA_STRUCT_ALIGN
  163.       #pragma options align=reset
  164.     #elif PRAGMA_STRUCT_PACKPUSH
  165.       #pragma pack(pop)
  166.     #elif PRAGMA_STRUCT_PACK
  167.       #pragma pack()
  168.     #endif
  169.  
  170.     #if OLD_COMPONENT_GLUE
  171.     struct ContrastEngineGetContrastRangeGluePB myContrastEngineGetContrastRangeGluePB = {
  172.         0,
  173.         8,
  174.         3
  175.     };
  176.  
  177.     #else
  178.     struct ContrastEngineGetContrastRangeGluePB myContrastEngineGetContrastRangeGluePB;
  179.     *((unsigned long*)&myContrastEngineGetContrastRangeGluePB) = 0x00080003;
  180.     #endif
  181.  
  182.     myContrastEngineGetContrastRangeGluePB.max = max;
  183.     myContrastEngineGetContrastRangeGluePB.min = min;
  184.     myContrastEngineGetContrastRangeGluePB.ec = ec;
  185.  
  186.     return (ContrastEngineResult)CallUniversalProc(CallComponentUPP, 0x000000F0, &myContrastEngineGetContrastRangeGluePB);
  187. }
  188.  
  189.  
  190. pascal ContrastEngineResult ContrastEngineGetContrast(ComponentInstance ec, short* contrast)
  191. {
  192.     #if PRAGMA_STRUCT_ALIGN
  193.       #pragma options align=mac68k
  194.     #elif PRAGMA_STRUCT_PACKPUSH
  195.       #pragma pack(push, 2)
  196.     #elif PRAGMA_STRUCT_PACK
  197.       #pragma pack(2)
  198.     #endif
  199.     struct ContrastEngineGetContrastGluePB {
  200.         unsigned char                  componentFlags;
  201.         unsigned char                  componentParamSize;
  202.         short                          componentWhat;
  203.         short*                         contrast;
  204.         ComponentInstance              ec;
  205.     };
  206.     #if PRAGMA_STRUCT_ALIGN
  207.       #pragma options align=reset
  208.     #elif PRAGMA_STRUCT_PACKPUSH
  209.       #pragma pack(pop)
  210.     #elif PRAGMA_STRUCT_PACK
  211.       #pragma pack()
  212.     #endif
  213.  
  214.     #if OLD_COMPONENT_GLUE
  215.     struct ContrastEngineGetContrastGluePB myContrastEngineGetContrastGluePB = {
  216.         0,
  217.         4,
  218.         4
  219.     };
  220.  
  221.     #else
  222.     struct ContrastEngineGetContrastGluePB myContrastEngineGetContrastGluePB;
  223.     *((unsigned long*)&myContrastEngineGetContrastGluePB) = 0x00040004;
  224.     #endif
  225.  
  226.     myContrastEngineGetContrastGluePB.contrast = contrast;
  227.     myContrastEngineGetContrastGluePB.ec = ec;
  228.  
  229.     return (ContrastEngineResult)CallUniversalProc(CallComponentUPP, 0x000000F0, &myContrastEngineGetContrastGluePB);
  230. }
  231.  
  232.  
  233. pascal ContrastEngineResult ContrastEngineSetContrast(ComponentInstance ec, short contrast)
  234. {
  235.     #if PRAGMA_STRUCT_ALIGN
  236.       #pragma options align=mac68k
  237.     #elif PRAGMA_STRUCT_PACKPUSH
  238.       #pragma pack(push, 2)
  239.     #elif PRAGMA_STRUCT_PACK
  240.       #pragma pack(2)
  241.     #endif
  242.     struct ContrastEngineSetContrastGluePB {
  243.         unsigned char                  componentFlags;
  244.         unsigned char                  componentParamSize;
  245.         short                          componentWhat;
  246.         short                          contrast;
  247.         ComponentInstance              ec;
  248.     };
  249.     #if PRAGMA_STRUCT_ALIGN
  250.       #pragma options align=reset
  251.     #elif PRAGMA_STRUCT_PACKPUSH
  252.       #pragma pack(pop)
  253.     #elif PRAGMA_STRUCT_PACK
  254.       #pragma pack()
  255.     #endif
  256.  
  257.     #if OLD_COMPONENT_GLUE
  258.     struct ContrastEngineSetContrastGluePB myContrastEngineSetContrastGluePB = {
  259.         0,
  260.         2,
  261.         5
  262.     };
  263.  
  264.     #else
  265.     struct ContrastEngineSetContrastGluePB myContrastEngineSetContrastGluePB;
  266.     *((unsigned long*)&myContrastEngineSetContrastGluePB) = 0x00020005;
  267.     #endif
  268.  
  269.     myContrastEngineSetContrastGluePB.contrast = contrast;
  270.     myContrastEngineSetContrastGluePB.ec = ec;
  271.  
  272.     return (ContrastEngineResult)CallUniversalProc(CallComponentUPP, 0x000000F0, &myContrastEngineSetContrastGluePB);
  273. }
  274.  
  275.  
  276. pascal ComponentResult AVEngineComponentTargetDevice(ComponentInstance engineComponent, DisplayIDType displayID)
  277. {
  278.     #if PRAGMA_STRUCT_ALIGN
  279.       #pragma options align=mac68k
  280.     #elif PRAGMA_STRUCT_PACKPUSH
  281.       #pragma pack(push, 2)
  282.     #elif PRAGMA_STRUCT_PACK
  283.       #pragma pack(2)
  284.     #endif
  285.     struct AVEngineComponentTargetDeviceGluePB {
  286.         unsigned char                  componentFlags;
  287.         unsigned char                  componentParamSize;
  288.         short                          componentWhat;
  289.         DisplayIDType                  displayID;
  290.         ComponentInstance              engineComponent;
  291.     };
  292.     #if PRAGMA_STRUCT_ALIGN
  293.       #pragma options align=reset
  294.     #elif PRAGMA_STRUCT_PACKPUSH
  295.       #pragma pack(pop)
  296.     #elif PRAGMA_STRUCT_PACK
  297.       #pragma pack()
  298.     #endif
  299.  
  300.     #if OLD_COMPONENT_GLUE
  301.     struct AVEngineComponentTargetDeviceGluePB myAVEngineComponentTargetDeviceGluePB = {
  302.         0,
  303.         4,
  304.         257
  305.     };
  306.  
  307.     #else
  308.     struct AVEngineComponentTargetDeviceGluePB myAVEngineComponentTargetDeviceGluePB;
  309.     *((unsigned long*)&myAVEngineComponentTargetDeviceGluePB) = 0x00040101;
  310.     #endif
  311.  
  312.     myAVEngineComponentTargetDeviceGluePB.displayID = displayID;
  313.     myAVEngineComponentTargetDeviceGluePB.engineComponent = engineComponent;
  314.  
  315.     return (ComponentResult)CallUniversalProc(CallComponentUPP, 0x000000F0, &myAVEngineComponentTargetDeviceGluePB);
  316. }
  317.